home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 700 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1010 b 

  1. Path: lsi.lsil.com!dsa129!song
  2. From: song@lsil.com (Song Liang)
  3. Newsgroups: comp.lang.c++
  4. Subject: How to print a enum variable's names
  5. Date: 5 Jan 1996 17:52:58 GMT
  6. Organization: LSI Logic Corporation
  7. Distribution: world
  8. Message-ID: <4cjohq$k5u@lsi.lsil.com>
  9. Reply-To: song@lsil.com sliang@cc.gatech.edu
  10. NNTP-Posting-Host: 147.145.58.129
  11.  
  12.   Suppose you have a variable foo of type "enum bar_type {CAR TRUCK VAN}", if 
  13. you do "cout << foo", it will print either 0, 1 or 2.  Is there a simple trick
  14. to print the names, i.e CAR, TRUCK or VAN?
  15.  
  16.   Thanks in advance.
  17.  
  18. ---
  19.  
  20. ---------------------------------------------------------------------------
  21.    Song Liang    Third Party Interface & CAD - dept. 7221       +-----+
  22.    LSI Logic Corporation            Phone: (408) 433-4531    LSI|LOGIC|
  23.    1501 McCarthy Blvd. M/S E-192    FAX:   (408) 433-4156       |     |
  24.    Milpitas, Ca.  95035             Email: song@lsil.com        +-----+
  25. ---------------------------------------------------------------------------
  26.  
  27.